package com.show.business.device.controller;
import com.show.business.common.core.controller.BaseController;
import com.show.business.device.bean.DeviceGroupAlarmPhone;
import com.show.business.device.service.IDeviceGroupAlarmPhoneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 设备分组手机设置 前端控制器
 * </p>
 *
 * @author dvlp
 * @since 2023-10-14
 */
@Api(value = "设备分组手机设置",description = "设备分组手机设置")
@RestController
@RequestMapping("/device/deviceGroupAlarmPhone")
public class DeviceGroupAlarmPhoneController extends BaseController {
    @Resource
    private IDeviceGroupAlarmPhoneService deviceGroupAlarmPhoneService;
    /**
     * 获取标签列表
     */
    @ApiOperation("获取标签列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", dataTypeClass = Integer.class)
    })
    @GetMapping("/page")
    public Object getPage(DeviceGroupAlarmPhone deviceGroupAlarmPhone) {
        startPage();
        List<DeviceGroupAlarmPhone> list = deviceGroupAlarmPhoneService.getList(deviceGroupAlarmPhone);
        return getDataTable(list);
    }
    /**
     * 添加标签
     */
    @ApiOperation("添加标签")
    @PostMapping("/save")
    public Object add(@RequestBody DeviceGroupAlarmPhone deviceGroupAlarmPhone) {
        return deviceGroupAlarmPhoneService.saveInfo(deviceGroupAlarmPhone);
    }
    /**
     * 更新标签
     */
    @ApiOperation("更新标签")
    @PostMapping("/edit")
    public Object edit(@RequestBody DeviceGroupAlarmPhone deviceGroupAlarmPhone) {
        return deviceGroupAlarmPhoneService.editInfo(deviceGroupAlarmPhone);
    }
    /**
     * 删除标签
     */
    @ApiOperation("删除")
    @ApiImplicitParam(name = "id", value = "主键ID", required = true, dataType = "String", dataTypeClass = String.class)
    @DeleteMapping("/del")
    public Object del(@RequestParam String[] id) {
        return deviceGroupAlarmPhoneService.delInfos(id);
    }
    /**
     * 标签详情
     */
    @ApiOperation("详情")
    @ApiImplicitParam(name = "id", value = "主键ID", required = true, dataType = "String", dataTypeClass = String.class)
    @GetMapping("/info")
    public Object getGoodsLabel(@RequestParam String id) {
        return deviceGroupAlarmPhoneService.getInfo(id);
    }
}
